#!/bin/sh

if [ "$ACTION" = add -a "x$DEVTYPE" = xbridge ]; then
    [ "$(uci -q get dockerd.globals.iptables)" = "1" ] || exit 0
    if [ "$DEVICENAME" = "docker0" ] || echo "$DEVICENAME" | grep -qE '^br-[0-9a-f]{12}$'; then
        echo "1" >/sys$DEVPATH/bridge/nf_call_iptables
        echo "1" >/sys$DEVPATH/bridge/nf_call_ip6tables
    fi
fi
